<template>
  <view class="w100p pr common_wrap">
    <CommonHeader v-if="statusKey == 1" :title="$t('付款中')" color="#000" backgroundColor="rgba(236,246,254,1)" :is-right="false"></CommonHeader>
    <CommonHeader v-if="statusKey == 2" :title="$t('已付款')" color="#000" backgroundColor="rgba(236,246,254,1)" :is-right="false"></CommonHeader>
    <CommonHeader v-if="statusKey == 3 || statusKey == 4" :title="$t('已结算')" color="#000" backgroundColor="rgba(236,246,254,1)" :is-right="false"></CommonHeader>
    <CommonHeader v-if="statusKey == 5" :title="$t('售后')" color="#000" backgroundColor="rgba(236,246,254,1)" :is-right="false"></CommonHeader>
	<view v-if="statusKey == 1 && detailInfo.day != 0" class="timeOut">
		{{$t('还剩')}}<uni-countdown :show-day="true" :hour="miniteObj.hour" :minute="miniteObj.minute" :second="miniteObj.second" color="#FF6A00" @timeup="onTimeup"></uni-countdown>{{$t('订单')}}{{$t('自动取消')}}
	</view>
    <view class="w100p flex-item oh"> 
      <scroll-view scroll-y class="w100p scroll-Y">
       <!-- <view class="w100p swiper_video" :style="{ top: +statusBarHeight + 44 + 'px' }">
          <swiper class="w100p swiper" circular :indicator-dots="true" indicator-color="#9B969A"
            indicator-active-color="#fff" :circular="true">
            <swiper-item v-if="!!currentVideo">
              <view class="pr video_wrap">
                <video id="myVideo" class="w100p  palyxxx" :src="currentVideo" :show-center-play-btn="true"
                  object-fit="cover" play-btn-position="center" :controls="true" :autoplay="true" muted
                  :poster="currntMainPic">
                </video>
                <view class="video-wrapxx">
                  <image :src="currntMainPic" mode="aspectFill"></image>
                </view>
                <cover-view v-show="isShow" class="pa play_wrap" @click="playsHeader(currentVideo)">
                  <view class="icon_wrap">
                    <u-icon name="play-right-fill" color="#fff" size="46"></u-icon>
                  </view>
                </cover-view>

              </view>
            </swiper-item>
            <swiper-item v-for="(item, index) in list" :key="index">
              <image class="w100p img" :src="item" mode="aspectFill" @click="amplifyImg(item)"></image>
            </swiper-item>
          </swiper>
          <cover-view v-show="isShow" class="pa history_wrap">
            <u-notice-bar class="w100p" mode="vertical" :is-circular="false" :volume-icon="false" type="none"
              :list="historyList" font-size="22" duration="5000"></u-notice-bar>
          </cover-view>
        </view> -->
       <!-- <view :style="{ marginTop: getTopR() }"></view> -->
        <!-- <view class="common_content pr w100p">
          <view class="w100p shop_card ">
            <view class="price-wrppx">采购{{$t('商品')}}</view>
            <view class="w100p flex-column card_wrap">
              <view class="namex">
                通用汽车桌垫四季通用冰凉透气透气通用汽 车桌垫四季通用冰凉透气
              </view>
            </view>
          </view>
          <cover-view class="pa swiper_wrap"></cover-view>
        </view> -->
        <!-- 采购 -->
        <view class="wrapper-info pr">
          <!-- 基础信息 -->
          <view class="base-info" @click="goPerson">
            <view class="left-avatar">
			  <view class="avatar">
			    <image :src="getImageUrl(detailInfo.avatar)" mode="aspectFill" class="w-100 h-100" style="border-radius: 500rpx;"></image>
			  </view>
            </view>
            <!-- 单数 -->
			<view style="flex: 1;">
              <view class="flex mt-10">
				<flag class="w-30 h-20 mr-4 ml-15" :country="detailInfo.country" />
				<view class="name ellipsis_one">{{detailInfo[plang('username')]}}</view>
              </view>
				<view :class="langR == 'zh'?'between h-60':'between h-60 r_between'">
				  <p class="user-sty" >
					{{
						[$t('供应商'),$t('经销商'),$t('货代公司'),$t('采购商'),$t('服务公司'),$t('报关公司'),$t('运输公司'),$t('国际物流公司'),$t('司机'),$t('服务商'),$t('俄罗斯个人'),$t('翻译员')][detailInfo.identity_type]
                  	}}

				  </p>
					<view class="right-numwrap">
						<view class="getInfo" @click.stop="inlineCall(detailInfo)">{{$t('联系TA')}}</view>
						<view class="getInfo" @click.stop="callPhone(detailInfo)">{{$t('打电话')}}<image
								src="/static/translatexx.png"
								class="translatexxxxxx"
								mode="widthFix"
							/></view>
					</view>
				</view>
			</view>
          </view>
		  <view v-if="!saleFlag" class="">
		  	
		  <view class="centerContBox">
		  	<view class="centerCont">
				<view class="flex">
					<view class="leftCont">
						<image class="pic" v-if="product_img_urls_show == true" :src="getImageUrl(detailInfo.product_img_urls.split(',')[0])" mode="aspectFill" />
						<image class="pic" v-else :src="getImageUrl(detailInfo.product_img_urls)" mode="aspectFill" />
					</view>
					<view class="cenCont ml-10">
						<view class="cenContTop">
							{{detailInfo[plang('product_name')]}}
						</view>
						<view class="cenContB">
							{{detailInfo[plang('category_name')]}}
						</view>
					</view>
				</view>
		  		<view class="rightCont">
		  			<view class="cenContTop font-bold">
		  				{{detailInfo.currency}} {{detailInfo.price}}
		  			</view>
		  			<view class="cenContB" style="text-align: right;">
		  				{{$t('共')}}{{detailInfo.amount}} {{$t('件')}}
		  			</view>
		  		</view>
		  	</view>
		  </view>
			<view class="caigou-info">
				<view class="title">
				  <view class="name">{{$t('订单信息')}}</view>
				  <view class="txt" @click="orderInfoOn=!orderInfoOn">
					<span>{{orderInfoOn? $t('收起'):$t('展开')}}</span> 
					<!-- <span class="arrowSty"></span> -->
					<image v-if="orderInfoOn" src="../../../static/icon/arrowIcon.png" mode="" class="w-20 h-15 ml-5" style="transform: rotate(180deg);"></image>
					<image v-else src="../../../static/icon/arrowIcon.png" mode="" class="w-20 h-15 ml-5"></image>
				  </view>
				</view>
				<view class="list">
				  <view class="txt">{{$t('币种')}}</view>
				  <view class="txt" style="color: #FF6A00;">{{detailInfo.currency}}</view>
				</view>
				<view class="list">
				  <view class="txt">{{$t('订单编号')}}</view>
				  <view class="txt" style="text-align: right;">{{detailInfo.order_number}}<span style="margin: 0 10rpx;">|</span><span @click="copyToClipboard(detailInfo.order_number)">{{$t('复制')}}</span></view>
				</view>
				<view class="" v-if="orderInfoOn">
					<view class="list">
					  <view class="txt">{{$t('买家选择运输方式')}}</view>
					  <view class="txt">{{ detailInfo.mailing_type == 1 ? $t('自提') : $t('卖家发货') }}</view>
					</view>
					<!-- <view class="list">
					  <view class="txt">技术服务费</view>
					  <view class="txt"></view>
					</view>
					<view class="list">
					  <view class="txt">{{$t('期望品牌')}}</view>
					  <view class="txt"></view>
					</view> -->
					<view class="list">
					  <view class="txt">{{$t('下单时间')}}</view>
					  <view class="txt">{{detailInfo.create_time}}</view>
					</view>
					<!-- <view class="list">
					  <view class="txt">支付银行账号</view>
					  <view class="txt">679990122000230744</view>
					</view>
					<view class="list">
					  <view class="txt">{{$t('开户行')}}</view>
					  <view class="txt" style="max-width: 500rpx;text-align: right;">黑河农村商业银行股份有限公司</view>
					</view> -->
					<view class="">
					  <view class="fz24 text-888">{{$t('收款账号图片')}}</view>
					  <view class="mt-10">
							<image
								:src="getImageUrl(urlImg)"
								mode="widthFix"
								@click="onPreview(urlImg)"
							></image>
					  </view>
					</view>
					<!-- <view class="list mt-10">
					  <view class="txt">支付状态</view>
					  <view class="txt" style="color: #03C24F;">成功</view>
					</view> -->
					<view v-if="detailInfo.payment_voucher" class="list">
					  <view class="txt">{{$t('支付凭证')}}</view>
					  <view class="flex img-overx">
							 <image v-for="item in detailInfo.payment_voucher.split(',')" :src="getImageUrl(item)" mode="aspectFill" class="w-150 h-150 ml-10" ></image>
					  </view>
					</view>
				</view>
			</view>
			<view class="caigou-info">
				<view class="title">
				  <view class="name">{{$t('订单总价')}}</view>
				  <view class="status font-bold">{{detailInfo.currency}} {{detailInfo.total_price}}</view>
				</view>
				<view class="list">
				  <view class="txt">{{$t('商品价格')}}</view>
				  <view class="txt font-bold">{{detailInfo.currency}} {{detailInfo.price}}</view>
				</view>
				<view class="list">
				  <view class="txt">{{$t('运费')}}</view>
				  <view class="txt font-bold">{{detailInfo.currency}} {{detailInfo.shipping_fee}}</view>
				</view>
				<!-- <view class="list">
				  <view class="txt">{{$t('优惠')}}</view>
				  <view class="txt font-bold">{{detailInfo.currency}} {{detailInfo.shipping_fee}}</view>
				</view> -->
				<!-- <view class="allPrice">
					{{$t('共减')}}<span style="margin-right: 20rpx;">{{detailInfo.currency}} {{detailInfo.shipping_fee}}</span>{{$t('总合计')}}<span>{{detailInfo.currency}} {{detailInfo.total_price}}</span>
				</view> -->
			</view>
			
			
			<view v-if="statusKey == 4 && detailInfo.settlement_info" class="caigou-info">
				<view class="title">
				  <view class="name">{{$t('GLUZ结算帐单')}}</view>
				  <view class="txt" @click="orderPayOn = !orderPayOn">{{orderPayOn ? $t('收起'):$t('展开')}}</view>
				</view>
				<view class="list">
				  <view class="txt">{{$t('付款金额')}}</view>
				  <view class="fz24 font-bold" style="color: #FF6A00;">{{detailInfo.currency}} {{get(detailInfo, 'settlement_info.pay_price')}}</view>
				</view>
				<view class="list">
				  	<view class="txt">{{$t('币种')}}</view>
				  <view class="fz24 font-bold" style="color: #FF6A00;">{{detailInfo.currency}}</view>
				</view>
				<view class="list">
				  <view class="txt">{{$t('技术服务费')}}	</view>
				  <view class="fz24 font-bold text-010">{{detailInfo.currency}} {{get(detailInfo, 'settlement_info.service_fee')}}</view>
				</view>
				<view class="" v-if="orderPayOn">
					<view class="list">
					  <view class="txt">{{$t('结算时间')}}</view>
					  <view class="txt">{{get(detailInfo, 'settlement_info.settlement_time')}}</view>
					</view>
					<view class="list">
					  <view class="txt">{{$t('支付银行账号')}}</view>
					  <view class="txt">{{get(detailInfo, 'settlement_info.bank_account')}}</view>
					</view>
					<view class="list">
					  <view class="txt">{{$t('开户行')}}</view>
					  <view class="txt" style="max-width: 500rpx;text-align: right;">{{get(detailInfo, 'settlement_info.opening_bank')}}</view>
					</view>
					<view class="list">
					  <view class="txt">{{$t('支付状态')}}</view>
					  <view class="fz24" style="color: #03C24F;">{{get(detailInfo, 'settlement_info.pay_status') == 1 ? $t('成功') : $t('失败')}}</view>
					</view>
					<!-- <view class="list">
					  <view class="txt">支付凭证</view>
					  <view class="imgs">
						  <image src="/static/caigou/pic.png" mode="aspectFill" class="w-150 h-150" ></image>
					  </view>
					</view> -->
				</view>
			</view>
			
			
			<view v-if="detailInfo.after_sales" class="caigou-info">
				<view class="title">
				  <view class="name">{{$t('售后详情')}}</view>
				  <view class="txt" @click="AfterSalesOpen=!AfterSalesOpen">{{AfterSalesOpen? $t('收起'):$t('展开')}}</view>
				</view>
				<view v-if="get(detailInfo, 'after_sales.buyer_agree_status') == 0" class="list">
				  <view class="txt">{{$t('申请原因')}}</view>
				  <view class="txt" style="max-width: 500rpx;text-align: right;">{{ get(detailInfo, `after_sales.${plang('reason')}`) }}</view>
				</view>
				<view class="list">
				  <view class="txt">{{$t('赔付比例')}}</view>
				  <view class="txt">{{ get(detailInfo, 'after_sales.buyer_agree_status') == 1 ? get(detailInfo, 'after_sales.platform_compensation_ratio') : get(detailInfo, 'after_sales.compensation_ratio') }}%</view>
				</view>
				<view class="" v-if="get(detailInfo, 'after_sales.buyer_agree_status') == 0 && AfterSalesOpen">
					<view class="list" style="align-items: flex-start;">
					  <view class="txt">{{$t('上传图片')}}</view>
					  <view >
						  <image v-for="item in get(detailInfo, 'after_sales.image_url').split(',')" :src="getImageUrl(item)" mode="aspectFill" class="w-150 h-150" ></image>
					  </view>
					</view>
					<view v-if="get(detailInfo, 'after_sales.video_url')" class="list" style="align-items: flex-start;">
					  <view class="txt">{{$t('上传视频')}}</view>
					  <view>
						  <image v-for="item in get(detailInfo, 'after_sales.video_url').split(',')" :src="getImageUrl(item)" mode="aspectFill" class="w-150 h-150" ></image>
						 <!-- <sunui-upimg :url="upPicUrl" ref="upload1" title="店铺logo" @upload="handleLoaded1" @change="handleChange1" :number="3" type="video"></sunui-upimg> -->
					  </view>
					</view>

				</view>
			</view>
			<view v-if="detailInfo.after_sales" class="h-200"></view>
			<view v-if="statusKey == 4 && detailInfo.pu_comment" class="caigou-info">
				<view class="title">
				  <view class="name">{{$t('评价')}}</view>
				  <view class="txt"></view>
				</view>
				<view class="evaluateBox">
					<view class="evaluateImg">
						<image :src="getImageUrl(get(detailInfo, 'pu_comment.user_info.avatar'))" mode=""></image>
					</view>
					<view class="evaluate">
						<view class="evaluateName">
							{{  get(detailInfo, `pu_comment.user_info.${plang('username')}`) }}
						</view>
						<view class="evaluateRate">
							<view class="flex-start mt-15">
								<view class="" v-for="(it, ind) in scoreList">
									<image v-if="it.num <= get(detailInfo, 'pu_comment.star')" class="ml-8 w-25 h-25"
										src="/static/img/starBright.png"></image>
									<image v-else class="ml-8 w-25 h-25" src="/static/img/starDark.png"></image>
								</view>
							</view>
						</view>
						<view class="evaluateCont">
							{{  get(detailInfo, `pu_comment.${plang('content')}`) }}
						</view>
						<view class="evaluateDate">
							<view class="">
								{{  get(detailInfo, 'pu_comment.create_time') }}
							</view>
							<!-- <view class="">
								黑龙江
							</view> -->
						</view>
					</view>
				</view>
			</view>
			
		
		</view>
			
			<view v-if="saleFlag"  class="caigou-info">
				<view class="">
				  <view class="text-010 fz28 font-bold">{{$t('申请原因')}}</view>
				  <view class="reasonSty">111</view>
				</view>
				<view class="title">
				  <view class="text-010 fz28 font-bold">{{$t('赔付比例')}}</view>
				  <view class="status"></view>
				</view>
				<view class="proportion">
					100%
				</view>
				<view class="title">
				  <view class="text-010 fz28 font-bold">{{$t('上传图片')}}</view>
				  <view class="">
				  </view>
				</view>
				<view class="">
					<!-- <sunui-upimg :url="upPicUrl" ref="upload1" title="店铺logo" @upload="handleLoaded1" @change="handleChange1" :number="3"></sunui-upimg> -->
					<image src="/static/caigou/pic.png" mode="aspectFill" class="w-150 h-150" ></image>
				</view>
				<view class="title">
				  <view class="text-010 fz28 font-bold">{{$t('上传视频')}}</view>
				  <view class="">
				  </view>
				</view>
				<view class="">
					<!-- <sunui-upimg :url="upPicUrl" ref="upload1" title="店铺logo" @upload="handleLoaded1" @change="handleChange1" :number="3" type="video"></sunui-upimg> -->
					<image src="/static/caigou/pic.png" mode="aspectFill" class="w-150 h-150" ></image>
				</view>
			</view>
			<view v-if="saleFlag" class="caigou-info" style="margin-bottom: 200rpx;">
				<view class="title">
				  <view class="text-010 fz28 font-bold">{{$t('平台协商意见')}}</view>
				  <view class="status"></view>
				</view>
				<view class="list">
				  <view class="txt">{{$t('赔付比例')}}</view>
				  <view class="txt"></view>
				</view>
				<view class="proportion">
					100%
					<!-- <input type="text" :placeholder="$t('请输入比例')" /> -->
				</view>
			</view>
			
          <view style="height: 16rpx;"></view>
		  
        </view>
		
      </scroll-view>
    </view>

	<view v-if="statusKey == 2 && detailInfo.mailing_type == 2" class="h-200"></view>
    <!-- 底部导航栏 -->
    <view class="footer-nav">
		<view v-if="statusKey == 1 && detailInfo.mailing_type == 2" class="">
			<view class="shippingFeeBox">        
				<view class="title">
					{{$t('填写运费价格')}}
				</view>
				<view class="ipt ml-10">
					<input type="number" v-model="price" :placeholder="$t('请输入运费')"/> 
					<p v-if="!price & submitBtn" class="fz22 mt-5 mb-10" style="color: #FF0000;">{{$t('请输入运费')}}</p>
				</view>
				<!-- <view class="sev">
					{{$t('切换')}}币种
				</view> -->
			</view> 
			<view v-if="statusKey == 1 && detailInfo.mailing_type == 2" class="footer-wrapper">
				<view class="center flex-col ml-20" @click="inquireShipping">
					<image src="../../../static/icon/talkIcon.png" mode="" class="w-45 h-45"></image>
					<p class="fz20 text-888" style="text-align: center;">{{$t('询问运费')}}</p>
				</view>
				<view class="btn blue" @click="submitMoney"> {{$t('确认提交')}} </view>
		  </view>
		</view>
		<view v-if="statusKey == 2 && detailInfo.mailing_type == 2">
			<view class="footer_btn4">
				<u-button class="btn_blue_all" @click="onSendShiping">
					{{$t('发布货源')}}
				</u-button>
			</view>
		</view>
		<view v-if="statusKey == 5">
			<view v-if="get(detailInfo, 'after_sales.buyer_agree_status') == 0" class="footer_btn4">
				<u-button :disabled="btnDis" class="btn_blue_all" @click="confirmApply(0)">
					{{$t('同意申请')}}
				</u-button>
			</view>
			<view v-else class="footer_btn4">
				<u-button :disabled="btnDis" class="btn_blue_all" @click="confirmApply(1)">
					{{$t('同意平台判定')}}
				</u-button>
			</view>
		</view>
    </view>

    <!-- 播放视频 -->
    <uni-popup ref="popupVideo" type="center" background-color="#000" mask-background-color="#000" class="popvexxx">
      <view class="wrapper-video">
        <video id="mainVideo" :src="playVideo" :show-center-play-btn="true" object-fit="cover"
          play-btn-position="center" :controls="true" :autoplay="true" class="video-main" :show-fullscreen-btn="false">
        </video>
      </view>
    </uni-popup>

    <!-- 图片放大 -->
    <uni-popup ref="popup" class="common_pop" mask-background-color="rgba(0,0,0,1)">
      <view class="w100p">
        <image class="w100p" :src="commonImg" mode="widthFix" @click="closePop"></image>
      </view>
    </uni-popup>
	
	<u-modal :confirm-text="$t('确定')" :show-title="false"  :cancel-text ="$t('取消')"  class="modalSty" v-model="confirmModal" :content="$t('货源已发布成功')+'!'"></u-modal>
	<u-modal :confirm-text="$t('确定')" :show-title="false"  :cancel-text ="$t('取消')"  class="modalSty" v-model="confirAskmModal" :content="$t('货源已发布成功,请等待其他用户报价')+'!'" @confirm="confirmAsk"></u-modal>
  </view>
</template>

<script>
import {
  mapState
} from 'vuex';
import {
  IMAGE_URL,
} from "@/config/app"

import CommonHeader from "@/pages/components/common-header.vue";
import sunuiUpimg from "@/components/tm-upload/tm-upload.vue";
import { sellDetaile, upShippingFee, yuntraceUpdate, sellerOperate } from '@/api/caigoOrder.js'
import { request_minute, scorePayment, chechkIm } from '@/api/basic.js'

export default {
  components: {
    CommonHeader,
	sunuiUpimg
  },
  data() {
    return {
      statusBarHeight: uni.getStorageSync("statusBarHeight"),
      videos: null, // 播放ref
      playVideo: '',
      commonImg: '',
	  btnDis: false,
      currntMainPic: '',
	  confirmModal: false,
	  confirAskmModal: false,
      currentVideo: '',
      isShow: true,
	  scoreList: [{
	  	num: 1
	  },
	  {
	  	num: 2
	  },
	  {
	  	num: 3
	  },
	  {
	  	num: 4
	  },
	  {
	  	num: 5
	  },
	  ],
	  price: '',
      historyList: [], //浏览记录列表
      list: [],
      product: {},
	  orderInfoOn:true,
	  orderPayOn: false,
	  AfterSalesOpen:false,
	  uniRate:2,
	  statusKey: 1,
	  detailInfo: {},
	  saleFlag: false,
	  submitBtn: false,
	  yuntrace_id: '',
	  upPicUrl: 'https://cx.csredian.com/app/index.php?i=7&c=entry&a=wxapp&v=2.2.4&do=upload_img&m=wjyk_sqpt',
	  product_img_urls_show:false,
	  urlImg: '',
		miniteObj: {
			hour: 0,
			minute: 0,
			second: 0
		}
    }
  },
  
  methods: {
		goPerson() {
      if (this.detailInfo.identity_type == 0) {
        uni.navigateTo({
          url: `/pages/details/merchantDetail?bid=${this.detailInfo.bid}`,
          webview: 'zWebViewShop'
        })
      } else {
        uni.navigateTo({
          url: `/pages/myPersonPage/index?targetUserId=${	this.detailInfo.publish_user_id}`,
          webview: 'zWebView'
        })
      }
    },
		// 倒计时
		onTimeup() {
			if(this.detailInfo.id) {
				this.sellDetaile(this.detailInfo.id);
			}
		},
		onPreview(urlImg) {
      uni.previewImage({
        urls: [urlImg],
        current: urlImg,
      });
    },
    getImg() {
      scorePayment({}).then((res) => {
        this.urlImg = res.data.data.img;
      });
    },
	  inlineCall(info) {
			if(uni.getStorageSync("user_id") == info.publish_user_id) {
				uni.showToast({
					title: this.$t('不能和自己聊天'),
					icon: "none",
				});
			} else {
				this.isMessageGo({
					action: 'initiateChat',
					data: info.publish_user_id
				})
				return;
				chechkIm({
					send_uid: uni.getStorageSync("user_id"),
					receive_uid: info.publish_user_id,
				}).then(res => {
					if (res.data.code == 1) {
						this.isMessageGo({
							action: 'initiateChat',
							data: info.publish_user_id
						})
					} else {
						if (res.data.data.send_user == false) {
							uni.$u.toast(this.$t('积分不足，请充值积分'))
							setTimeout(() => {
								uni.navigateTo({
									url: '/pages/vip/scorePoint',
								})
							}, 500)
						} else {
							uni.$u.toast(this.$t('对方积分不足'))
						}
					}
				})
			}


	  	// this.isMessageGo({
	  	// 	action: 'initiateChat',
	  	// 	data: info.publish_user_id
	  	// })
	  },
	  callPhone(item) {
	  	if(uni.getStorageSync("user_id") == item.publish_user_id) {
	  		uni.showToast({
	  			title: '不能给自己打电话',
	  			icon: "none",
	  		});
	  	} else {
	  		request_minute({
	  			user_id: uni.getStorageSync("user_id"),
	  			target_id: item.publish_user_id,
	  		}).then(res => {
	  			if (res.data.data.flag == 1) {
	  				this.isMessageGo({
	  					action: 'call',
	  					data: {
	  						userId: item.publish_user_id,
	  						type: res.data.data.type || 1,
	  					}
	  				})
	  			} else {
	  				uni.showToast({
	  					title: this.$t('积分不足，请充值积分'),
	  					icon: "none",
	  				});
	  				setTimeout(() => {
	  					uni.navigateTo({
	  						url: '/pages/vip/scorePoint',
	  						webview: 'zWebView'
	  					})
	  				}, 500)
	  			}
	  		})
	  	}
	  },
    // 发货
    onSendShiping() {
      uni.navigateTo({
        url:`/pages/publish/start?orderId=${this.detailInfo.id}`,
        webview: 'zWebView',
      })
    },
	// 询问运费
	inquireShipping() {
		uni.navigateTo({
		  url:`/pages/publish/start?askFlag=1&orderId=${this.detailInfo.id}`,
		  webview: 'zWebView',
		})
	},
	confirmApply(key) {
		this.btnDis = true
		sellerOperate({
			user_id: uni.getStorageSync('user_id'),
			order_id: this.detailInfo.order_id,
			after_id: this.detailInfo.after_sales.id,
			status: 1,
			seller_agree_status: key
		}).then(res => {
			if (res.data.code == 200) {
				uni.$u.toast(res.data.message)
				uni.redirectTo({
					url: '/pages/caigou/order/index?type=2&status=4'
				})
			} else {
				uni.$u.toast(res.data.message)
				this.btnDis = false
			}
		})
	},
	confirmAsk() {
		this.confirAskmModal = false
	},
	confirmId() {
		// return
		uni.showLoading({
			title: 'loading'
		});
		yuntraceUpdate({
			user_id: uni.getStorageSync('user_id'),
			order_id: this.detailInfo.order_id,
			yuntrace_id: this.yuntrace_id
		}).then(res => {
			this.confirmModal = false
			uni.hideLoading()
			uni.redirectTo({
				url: '/pages/caigou/order/index?type=2&status=3'
			})
		})
	},
	submitMoney() {
		this.submitBtn = true  
		if(!this.price) return
		if (this.detailInfo.shipping_fee != '0.00' && (Number(this.price).toFixed(2) >= Number(this.detailInfo.shipping_fee))) {
			uni.$u.toast(this.$t('本次输入运费不可高于上次填报的运费'))
			return
		}
		upShippingFee({
			user_id: uni.getStorageSync('user_id'),
			order_id: this.detailInfo.order_id,
			shipping_fee: Number(this.price).toFixed(2)
		}).then(res => {
			if (res.data.code == 200) {
				uni.redirectTo({
					url: '/pages/caigou/order/index?type=2&status=1'
				})
			} else {
				uni.$u.toast(res.data.message)
			}
		})
	},
    // 查看物流
    onSeeWuliu() {
      uni.navigateTo({
        url:'/pages/shipmentRecord/index?status=3',
        webview: 'zWebView',
      })
    },
	// 复制文本到剪切板
	copyToClipboard(text) {
	    uni.setClipboardData({
	        data: text,
	        success:  ()=> {
	            uni.showToast({
	                title: this.$t('复制成功'),
	                icon: 'success',
	                duration: 2000
	            });
	        },
	        fail:  ()=> {
	            uni.showToast({
	                title: this.$t('复制失败'),
	                icon: 'none',
	                duration: 2000
	            });
	        }
	    });
	},
    getTopR() {
      return `calc(${+this.statusBarHeight}px + 44px + 400rpx)`
    },
    // 播放头部视频
    playsHeader(video) {
      // 判断安卓
      const systemInfo = uni.getSystemInfoSync();
      // 判断是否为 Android 系统
      if (systemInfo.platform === 'android') {
        this.playVideo = video;
        this.$refs.popupVideo.open()
        return;
      }
      this.videos.requestFullScreen();
      this.$nextTick(() => {
        this.videos.play();
      })
    },
    // 关闭图片弹窗
    closePop() {
      this.$refs.popup.close();
    },
    // 图片放大
    amplifyImg(imgUrl) {
      if (!imgUrl) return;
      this.commonImg = imgUrl;
      this.$refs.popup.open();
    },
	// 获取详情
	sellDetaile(id) {
		sellDetaile({
			id: id,
			user_id: uni.getStorageSync('user_id')
		}).then(res => {
			if (res.data.code == 200) {
				this.detailInfo = res.data.data
				this.product_img_urls_show = res.data.data.product_img_urls.includes(",")
				if(this.detailInfo.shipping_fee != '0.00') {
					this.price = this.detailInfo.shipping_fee
				}
			
				let time = this.detailInfo.day;
				this.miniteObj.hour = Math.floor(time / 3600)
				this.miniteObj.minute = Math.floor((time % 3600) / 60)
				this.miniteObj.second = time % 60
				if (this.confirmModal) {
					this.confirmId();
				}
			} else {
				uni.$u.toast(res.data.message)
			}
			
		})
	},
    // 获取数据
    async getData() {
      const { data } = await this.$u.api.shopping.getProduct({
        id: 338,
      });
      this.currntMainPic = data.product.pic;
      this.list = [data.product.pic, data.product.pic, data.product.pic];
      this.currentVideo = data.product.video;
      this.product = data.product;
    },
    // 浏览记录列表
    async getHistoryData() {
      try {
        const {
          data
        } = await this.$u.api.shopping.getMemberHistory({
          id: 338,
          type: "shop",
        });
        this.historyNum = data.member_history_count || 0;
        if (!!data.member_history?.length) {
          let arr = [];
          data.member_history.map((item, index) => {
            let str = item[this.plang('username')] + this.$t("正在查看");
            arr.push(str)
          })
          this.historyList = [...arr];
        }
      } catch (e) {

      }
    },
  },

  onLoad(options) {
	if (options.status) {
		this.statusKey = options.status
	}
	if(options.saleFlag) {
		this.saleFlag = options.saleFlag
	}
	if(options.id) {
		this.sellDetaile(options.id)
	}
	if (options.confirmModal) {
		this.sellDetaile(options.orderId)
		this.confirmModal = options.confirmModal
		this.yuntrace_id = options.yunzongId
	}
	if(options.confirAskmModal) {
		this.sellDetaile(options.orderId)
		this.confirAskmModal = options.confirAskmModal
	}
    this.videos = uni.createVideoContext('myVideo');
		this.getImg()

    // this.getData();
    // this.getHistoryData();
  },
}
</script>

<style scoped lang="scss">
	@import '@/assets/appScss.scss';
@import './index.scss';
.user-sty {
		background-image: url('../../../static/userLogoBg.png');
		background-size: 100% 100%;
		margin-left: 12rpx;
		min-width: 120rpx;
		font-family: YouSheBiaoTiHei;
		font-weight: 400;
		font-size: 20rpx;
		line-height: 30rpx;
		box-shadow: 0rpx 1.25rpx 0.75rpx 0rpx #D061024D;
		color: #FFFFFF;
		text-align: center;
		padding-left: 26rpx;
	}
	.footer_btn4{
		position: fixed;
		left:0;
		bottom: 0;
		right: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #fff;
		padding:30rpx 24rpx 60rpx;
		z-index: 10;
		/deep/ .u-btn {
			padding: 0 !important;
		}
		/deep/ uni-button {
			padding: 0 !important;
			margin: 0 !important;
		}
		/deep/ .u-hairline-border[data-v-3bf2dba7]:after {
			border: none !important;
		}
		.btn_blue_all {
			width: 97%;
			height: 94rpx;
			flex-shrink: 0;
			border-radius: 18rpx;
			// border: 2rpx solid rgba(3, 189, 130, 0.10);
			background-color: #278AFF;
			color: #FFF;
			font-family: "PingFang SC";
			font-size: 30rpx;
			font-style: normal;
			font-weight: 600;
			text-align: center;
			line-height: 94rpx; 
			padding: 0;
		}
		.btn_blue{
			width: 49%;
			height: 94rpx;
			flex-shrink: 0;
			border-radius: 18rpx 0 0 18rpx;
			// border: 2rpx solid rgba(3, 189, 130, 0.10);
			background-color: #278AFF;
			color: #FFF;
			font-family: "PingFang SC";
			font-size: 30rpx;
			font-style: normal;
			font-weight: 600;
			text-align: center;
			line-height: 94rpx; 
			padding: 0;
		}
		.btn_green{
			width: 49%;
			height: 94rpx;
			flex-shrink: 0;
			border-radius: 0 18rpx 18rpx 0;
			// border: 2rpx solid rgba(3, 189, 130, 0.10);
			background-color: #03C24F;
			color: #FFF;
			font-family: "PingFang SC";
			font-size: 30rpx;
			font-style: normal;
			font-weight: 600;
			text-align: center;
			line-height: 94rpx;
			padding: 0;
		}
	}
	.r_between{
		.user-sty{
			padding:0 10rpx;
			background-image:none;
			border-radius: 500px;
			background: linear-gradient(90deg, #FF7000 0%, #FFA245 100%);
			box-shadow: -4px 4px 6px 0px rgba(255, 203, 151, 0.46) inset, -2px -3px 9.9px 0px #FFBE7C inset, 0px 4px 13.8px 0px #DEE1EF;


		}
	}


	.img-overx {
		overflow-x: auto;
		flex: 1;
		image {
			flex-shrink: 0;
		}
	}
</style>